package com.dlm.controller;

import com.dlm.dao.Evaluate;
import com.dlm.dao.HisAddress;
import com.dlm.service.IAddressService;
import com.dlm.service.IEvaluateService;
import com.dlm.service.impl.AddressServiceImpl;
import com.dlm.service.impl.EvaluateServiceImpl;
import com.google.common.base.Preconditions;
import com.jfinal.plugin.activerecord.Page;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;

/**
 * Created by chongsong on 15/2/1.
 * <mailto>chong.song@autonavi.com</mailto>
 */
public class HisAddressController extends BaseController {
    private Logger logger = Logger.getLogger(HisAddressController.class);
    private IAddressService service = new AddressServiceImpl();

    public void findLast() {
        if(getSession().getAttribute("openid") == null){
            renderJson(makeDto(100,"请先登录!" , null));
            return;
        }
        try {
            HisAddress ha = service.findLastAddr((String) getSession().getAttribute("openid"));
            if (ha != null) {
                renderJson(makeDto(0, "ok", ha));
                return;
            }
        } catch (Exception e) {
            logger.error(e.getMessage(), e);
        }
        renderJson(makeDto(1, "查询失败!", null));
    }
}
